package com.loongtech.bi.manager.game;

import java.util.Date;
import java.util.List;

import org.springframework.stereotype.Service;

import com.loongtech.bi.entity.game.EntityUserSevenLoss1LevelDistribute;
import com.loongtech.core.jpa.manager.ManagerQueryCacheBase;
/**
 * 用户的三日流失
 * @author lihui
 *
 */
@Service
public class UserSevenLoss1LevelDistributeManager extends ManagerQueryCacheBase<EntityUserSevenLoss1LevelDistribute> {
	private static final long serialVersionUID = 1L;
	
	/**
	 * 获取所有平台的人数，按照等级分组
	 * @param dayDate
	 * @return
	 */
	public List<Object[]> getAllKindUserNumberGroupByLevel(Date dateStart, Date dateEnd,String queryPlatform, String queryChannel, String queryServer) {
		return findByQuery("select level,sum(user_number) from EntityUserSevenLoss1LevelDistribute where day>=:dayStart and day<=:dayEnd and platformid = '"+queryPlatform+"' and channelid = '"+queryChannel+"' and serverid = '"+queryServer+"' group by level order by sum(user_number) desc ", "dayStart", dateStart, "dayEnd", dateEnd);
	}
	
	/**
	 * 获取所有平台的人数
	 * @param dayDate
	 * @return
	 */
	public List<Object[]> getAllKindUserNumber(Date dateStart, Date dateEnd,String queryPlatform, String queryChannel, String queryServer)  {
		return findByQuery("select sum(user_number),count(user_number) from EntityUserSevenLoss1LevelDistribute where day>=:dayStart and day<=:dayEnd and platformid = '"+queryPlatform+"' and channelid = '"+queryChannel+"' and serverid = '"+queryServer+"' ", "dayStart", dateStart, "dayEnd", dateEnd);
	}
}
